package com.mumu.quratz.job;

import com.mumu.quratz.constant.ScheduleConstants;
import lombok.extern.slf4j.Slf4j;
import org.quartz.*;
import org.springframework.stereotype.Component;

/**
 * @author mumu
 * @version 1.0
 * @date 2023/12/12 17:11
 * @describe
 */
@Slf4j
@Component
public class TestJob implements Job {

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        JobDetail jobDetail = context.getJobDetail();
        JobKey jobKey = jobDetail.getKey();
        //工作任务名称
        String jobName = jobKey.getName();
        //工作任务组名称
        String groupName = jobKey.getGroup();
        //任务类名称(带路径)
        String classPathName = context.getJobDetail().getJobClass().getName();
        //任务类名称
        String className = context.getJobDetail().getJobClass().getSimpleName();
        //获取Trigger内容
        TriggerKey triggerKey = context.getTrigger().getKey();
        //触发器名称
        String triggerName = triggerKey.getName();
        //出发组名称(带路径)
        String triggerPathName = context.getTrigger().getClass().getName();
        //触发器类名称
        String triggerClassName = context.getTrigger().getClass().getSimpleName();

        Object o = jobDetail.getJobDataMap().get(ScheduleConstants.TASK_PROPERTIES);

        log.info("---{}---{}---{}", jobKey, jobName, groupName);
    }


}
